FROM ubuntu/mysql:8.0-20.04_beta

RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
    && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8

RUN apt-get update && apt-get install -y --no-install-recommends apt-utils build-essential software-properties-common && \
    curl wget unzip nano git net-tools vim && \
    add-apt-repository -y ppa:openjdk-r/ppa && \
    apt-get update && \
    apt-get -y install openjdk-8-jdk

ENV PATH /opt/conda/bin:$PATH

## Install conda
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh -O ~/miniconda.sh && \
    /bin/bash ~/miniconda.sh -b -p /opt/conda && \
    rm ~/miniconda.sh && \
    /opt/conda/bin/conda clean -tipsy && \
    ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
    echo ". /opt/conda/etc/profile.d/conda.sh" >> /etc/profile && \
    echo "conda activate base" >> /etc/profile && \
    . /etc/profile

RUN mkdir ~/.pip
RUN echo "[global]\n trusted-host = mirrors.aliyun.com\n index-url = https://mirrors.aliyun.com/pypi/simple" > ~/.pip/pip.conf

## Install python packages
RUN  . /etc/profile && pip install --upgrade pip && pip install --no-cache-dir \
Cython numpy pandas scikit-learn plotly ray[default]==1.3.0 \
watchdog requests click uuid sfcli \
aiohttp psutil setproctitle grpcio xlsxwriter \
watchdog requests click uuid sfcli pyjava>=0.2.8.8 \
pyarrow

## Copy db init.sql
COPY db_init.sql /docker-entrypoint-initdb.d/
